<?php

//-----------------------------------
function loadHeaders( $sBaseDir = '.' )
{
	$B_DEBUG = isset( $_GET[ 'debug' ] );

	if( $B_DEBUG )
	 echo( "<title>Pulse (debug)</title>\n" );
	else
	 echo( "<title>Pulse</title>\n" );
	 
	 //-----------------------------------
	// CSS
	//-----------------------------------
	$sCssFiles = array(
	  'ext-all.css',
	  'content.css',
	  'windows.css',
	  'manager.css',
	  'index.css'
	 );
	 
	//-----------------------------------
	// JS (libs)
	//-----------------------------------
	$sLibJsFiles = array(
	  'jquery.js',
	  'ext-jquery-adapter.js',
	  'debug/ext-all.js',
	  'XmlTreeLoader.js',
	  'FileUploadField.js',
	  'ProjectTreeContextMenu.js',
	  'ContentTabContextMenu.js',
	  'tinyxmlsax.js',
	  'tinyxmlw3cdom.js'
	 );
	
	//-----------------------------------
	// JS 
	//-----------------------------------
	$sJsFiles = array(
	  'kernel/pulse.js',
	  'kernel/file.js',
	  'kernel/server.js',
	  'app/content.js',
	  'gui/widget_base.js',
		'gui/image.js',
	  'gui/project.js',
	  'gui/content.js',
	  'gui/winUploadFile.js',
	  'gui/main.js'
	 );
	 
	// Dirs 
	$sCssDir    = $sBaseDir.'/css';
	$sJsDir     = $sBaseDir.'/js';
	$sLibJsDir  = $sJsDir.'/lib';
	if ( !$B_DEBUG ) 
		$sJsDir     .= '/min';
	
	function includeCss( $sDir, $sRelativePath )
	{
	  echo( '<link rel="stylesheet" type="text/css" href="'.$sDir.'/'.$sRelativePath."\" />\n" );
	}
	function includeJs( $sDir, $sRelativePath )
	{
		echo( '<script type="text/javascript" src="'.$sDir.'/'.$sRelativePath."\"></script>\n" );
	}
	
	for ( $i = 0; $i < sizeof( $sCssFiles ); ++$i )
	  includeCss( $sCssDir, $sCssFiles[ $i ] );
	    
	for ( $i = 0; $i < sizeof( $sLibJsFiles ); ++$i )
	  includeJs( $sLibJsDir, $sLibJsFiles[ $i ] );
	
	for ( $i = 0; $i < sizeof( $sJsFiles ); ++$i )
	  includeJs( $sJsDir, $sJsFiles[ $i ] );
}
?>